package com.woniuxy.order.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 订单申请实体类
 */
@Data
@TableName("order_application")
public class OrderApplication {
    
    @TableId(type = IdType.AUTO)
    private Long id;
    
    @TableField("order_no")
    private String orderNo;
    
    @TableField("customer_id")
    private Long customerId;
    
    @TableField("customer_name")
    private String customerName;
    
    @TableField("office_business_id")
    private Long officeBusinessId;
    
    @TableField("office_business_name")
    private String officeBusinessName;
    
    @TableField("product_name")
    private String productName;
    
    @TableField("product_spec")
    private String productSpec;
    
    @TableField("quantity")
    private Integer quantity;
    
    @TableField("unit_price")
    private BigDecimal unitPrice;
    
    @TableField("total_amount")
    private BigDecimal totalAmount;
    
    @TableField("delivery_address")
    private String deliveryAddress;
    
    @TableField("contact_person")
    private String contactPerson;
    
    @TableField("contact_phone")
    private String contactPhone;
    
    @TableField("order_description")
    private String orderDescription;
    
    @TableField("application_status")
    private String applicationStatus = "PENDING";
    
    @TableField("process_instance_id")
    private String processInstanceId;
    
    @TableField("current_approver")
    private String currentApprover;
    
    @TableField("current_step")
    private String currentStep;
    
    @TableField("reject_reason")
    private String rejectReason;
    
    @TableField("reject_step")
    private String rejectStep;
    
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private LocalDateTime createTime;
    
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;
    
    @TableField("create_by")
    private String createBy;
    
    @TableField("update_by")
    private String updateBy;
    
    /**
     * 申请状态枚举
     */
    public enum ApplicationStatus {
        PENDING("待审批"),
        APPROVED("已通过"),
        REJECTED("已拒绝"),
        CANCELLED("已取消");
        
        private final String description;
        
        ApplicationStatus(String description) {
            this.description = description;
        }
        
        public String getDescription() {
            return description;
        }
    }
}

